package org.grottarossa.ui.core.casemanagement.bpm.actionsbar;


import java.util.ResourceBundle;

import org.grottarossa.template.data.pojo.workflows.WorkItem;
import org.grottarossa.template.data.pojo.workflows.Workflow;
import org.grottarossa.ui.core.ApplicationSession;
import org.grottarossa.ui.core.base.IBaseComponent;
import org.grottarossa.ui.core.i18n.DM;

import com.vaadin.ui.Window;

/***
 * Factory per le buttons bar di gestione lock/unlock/suspend/assign task
 * @author 
 *
 */
public class LockBarFactory
{
	private final ApplicationSession m_appSession;

	public LockBarFactory(ApplicationSession appSession)
	{
		this.m_appSession = appSession;

	}

	/***
	 * Crea una buttons bar di gestione lock/unlock/suspend/assign task
	 * @param workflow
	 * @param instance
	 * @param viewer
	 * @return
	 */
	public LockBar createLockBar(Workflow workflow, WorkItem instance, IBaseComponent viewer)
	{
		ResourceBundle localizer = DM.instance().getBundle(getClass().getPackage().getName() + ".Resources");
		LockBar view = new LockBar(m_appSession, localizer);
		LockBarPresenter presenter = new LockBarPresenter(m_appSession, view, workflow, instance, localizer, viewer);
		presenter.initialize();
		return view;
	}
}
